package com.wangy.database.jdbc;

import java.sql.SQLException;

import javax.sql.DataSource;

public class SessionFactory {
	
	private  DataSource dataSource;
	
	
	public Session getSession(){
		Session session = new Session();
		try {
			session.setConnection(dataSource.getConnection());
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return session;
	}

	public DataSource getDataSource() {
		return dataSource;
	}

	public void setDataSource(DataSource dataSource) {
		this.dataSource = dataSource;
	}

	

	

}
